<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>用户信息展示</title>
    <link rel="stylesheet" href="css/user_update.css">
    <link rel="stylesheet" href="css/blog_list.css">
    <script src="js/jquery.min.js"></script>
    <script src="js/common.js"></script>
</head>

<body>
     <!-- 导航栏 -->
    <div class="nav">
      <img src="img/logo2.jpg" alt="">
      <a class="title" href="myblog_list.html">我的博客系统</a>
      <!-- 用来占据中间位置 -->
      <span class="spacer"></span>
      <a href="blog_list.html">主页</a>
      <a href="blog_add.html">写博客</a>
      <a href="javascript:logout()">注销</a>
      <!-- <a href="#">注销</a> -->
  </div>
  <!-- 版心 -->
  <div class="container">
        <div class="card">
            <div class="login-dialog">
          
            <img src="" class="avtar" alt="" id="photo">
            <div class="row">
                <span>用户名</span>
                <span id="username"></span>
            </div>
            <div class="row">
              <span>id </span>
              <span id="id"></span>
            </div>
            <div class="row">
              <span>gitee地址 </span>
              <span id="gitee"></span>
            </div>
            <div class="row">
              <span>性别 </span>
              <span id="gender"></span>
            </div>
            <div class="row">
              <span>个人简介 </span>
              <span id="showself"></span>
            </div>
            <div class="row">
              <span>所在地区 </span>
              <span id="place"></span>
            </div>
            <button onclick="redirectToUserInfo()">修改个人信息</button>
            <div>
              <a href="user_secretjudge.html">设置密保</a>
              <a href="excessive.html">修改密码</a>
        </div>
    </div>

    <script>
        function redirectToUserInfo() {
            window.location.href = "user_update.html";
        }
      //获取个人信息
      function showInfo(){
            jQuery.ajax({
                url:"/user/showuserinfo",
                type:"POST",
                data:{},
                success:function(result){
                    if(result!=null && result.code==200){
                        jQuery("#id").text(result.data.id);
                        jQuery("#username").text(result.data.username);
                        jQuery("#gender").text(result.data.gender);
                        jQuery("#gitee").text(result.data.gitee);
                        jQuery("#showself").text(result.data.showself);
                        jQuery("#place").text(result.data.place);
                        $("#photo").attr("src","http://"+ location.host + result.data.photo);
                    }else{
                        alert("个人信息加载失败，请重新刷新再试！");
                    }
                }
            });
        }
        showInfo();

       
        
    </script>
 
    
</body>

</html>